package com.ruoyi.recipe.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.recipe.domain.RecipeDishItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.recipe.mapper.RecipeDishStepMapper;
import com.ruoyi.recipe.domain.RecipeDishStep;
import com.ruoyi.recipe.service.IRecipeDishStepService;
import com.ruoyi.common.core.text.Convert;

/**
 * 步骤Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-23
 */
@Service
public class RecipeDishStepServiceImpl implements IRecipeDishStepService 
{
    @Autowired
    private RecipeDishStepMapper recipeDishStepMapper;

    /**
     * 查询步骤
     * 
     * @param stepId 步骤主键
     * @return 步骤
     */
    @Override
    public RecipeDishStep selectRecipeDishStepByStepId(Long stepId)
    {
        return recipeDishStepMapper.selectRecipeDishStepByStepId(stepId);
    }

    /**
     * 查询步骤列表
     * 
     * @param recipeDishStep 步骤
     * @return 步骤
     */
    @Override
    public List<RecipeDishStep> selectRecipeDishStepList(RecipeDishStep recipeDishStep)
    {
        return recipeDishStepMapper.selectRecipeDishStepList(recipeDishStep);
    }

    @Override
    public int selectMaxStepSort(RecipeDishStep recipeDishStep) {
        return recipeDishStepMapper.selectMaxStepSort(recipeDishStep);
    }

    /**
     * 新增步骤
     * 
     * @param recipeDishStep 步骤
     * @return 结果
     */
    @Override
    public int insertRecipeDishStep(RecipeDishStep recipeDishStep)
    {
        recipeDishStep.setCreateTime(DateUtils.getNowDate());
        return recipeDishStepMapper.insertRecipeDishStep(recipeDishStep);
    }

    @Override
    public int batchInsertRecipeDishStep(List<RecipeDishStep> list) {
        return recipeDishStepMapper.batchInsertRecipeDishStep(list);
    }

    /**
     * 修改步骤
     * 
     * @param recipeDishStep 步骤
     * @return 结果
     */
    @Override
    public int updateRecipeDishStep(RecipeDishStep recipeDishStep)
    {
        recipeDishStep.setUpdateTime(DateUtils.getNowDate());
        return recipeDishStepMapper.updateRecipeDishStep(recipeDishStep);
    }

    /**
     * 批量删除步骤
     * 
     * @param stepIds 需要删除的步骤主键
     * @return 结果
     */
    @Override
    public int deleteRecipeDishStepByStepIds(String stepIds)
    {
        return recipeDishStepMapper.deleteRecipeDishStepByStepIds(Convert.toStrArray(stepIds));
    }

    /**
     * 删除步骤信息
     * 
     * @param stepId 步骤主键
     * @return 结果
     */
    @Override
    public int deleteRecipeDishStepByStepId(Long stepId)
    {
        return recipeDishStepMapper.deleteRecipeDishStepByStepId(stepId);
    }

    @Override
    public int deleteRecipeDishStepByDishId(Long dishId) {
        return recipeDishStepMapper.deleteRecipeDishStepByDishId(dishId);
    }

    @Override
    public int deleteRecipeDishStepByDishIds(String[] dishIds) {
        return recipeDishStepMapper.deleteRecipeDishStepByDishIds(dishIds);
    }
}
